#pragma once

#include "../umlmodel_global.h"

#include <memory>
#include <vector>

#include "LinkEndData.h"

using std::make_shared;
using std::shared_ptr;
using std::vector;

namespace uml {
class InputPin;

/// <summary>
/// LinkEndCreationData
/// LinkEndCreationData is LinkEndData used to provide values for one end of a link
/// to be created by a CreateLinkAction.
/// </summary>
class UMLMODEL_EXPORT LinkEndCreationData : public LinkEndData {

public: // Constructors and destructors
    explicit LinkEndCreationData(const QString& umlType="uml::LinkEndCreationData");

public: // JsonSerializable override
    void fromJson(const QJsonObject& json, QStringList& errorList) override;
    void toJson(QJsonObject& json) override;

public: // Methods
    /// <summary>
    /// allPins
    /// Adds the insertAt InputPin (if any) to the set of all Pins.
    /// </summary>
    shared_ptr<vector<InputPin>> allPins() const override;

public: // Properties
    /// <summary>
    /// insertAt getter
    /// For ordered Association ends, the InputPin that provides the position where the
    /// new link should be inserted or where an existing link should be moved to. The
    /// type of the insertAt InputPin is UnlimitedNatural, but the input cannot be zero.
    /// It is omitted for Association ends that are not ordered.
    /// </summary>
    shared_ptr<InputPin> insertAt() const;

    /// <summary>
    /// insertAt setter
    /// For ordered Association ends, the InputPin that provides the position where the
    /// new link should be inserted or where an existing link should be moved to. The
    /// type of the insertAt InputPin is UnlimitedNatural, but the input cannot be zero.
    /// It is omitted for Association ends that are not ordered.
    /// </summary>
    void setInsertAt(shared_ptr<InputPin> value);

    /// <summary>
    /// isReplaceAll getter
    /// Specifies whether the existing links emanating from the object on this end
    /// should be destroyed before creating a new link.
    /// </summary>
    bool isReplaceAll() const;

    /// <summary>
    /// isReplaceAll setter
    /// Specifies whether the existing links emanating from the object on this end
    /// should be destroyed before creating a new link.
    /// </summary>
    void setIsReplaceAll(bool value);

private: // Fields
    /// <summary>
    /// insertAt
    /// For ordered Association ends, the InputPin that provides the position where the
    /// new link should be inserted or where an existing link should be moved to. The
    /// type of the insertAt InputPin is UnlimitedNatural, but the input cannot be zero.
    /// It is omitted for Association ends that are not ordered.
    /// </summary>
    shared_ptr<InputPin> insertAt_;

    /// <summary>
    /// isReplaceAll
    /// Specifies whether the existing links emanating from the object on this end
    /// should be destroyed before creating a new link.
    /// </summary>
    const static bool isReplaceAll_default_;
    bool isReplaceAll_= isReplaceAll_default_;

};

} // namespace uml
